<?php
$page=1;
$limit=10;
//$page=isset($_GET["page"])?$_GET["page"]:1;
//$limit=$_GET['limit'];

	include '../conn/conn.php';
	include '../isLogin_json.php';

$user = $_SESSION['jsjgcxusername'];
$count=mysqli_num_rows(mysqli_query($link,"select * from tb_news where state = 3 and author = '$user'"));
$perpage=ceil($count/$limit);

$sql="select  *from tb_news where state = 3 and author = '$user' limit ".($page-1)*$limit.",".$limit;
//$sql="select*from tb_news where state = 1 and author = '$user' order  by no desc";
$result=mysqli_query($link, $sql);
//var_dump($sql);

if (mysqli_num_rows($result) > 0)  {
  echo '{"code":0,"msg":"","count":'.$count.',"data":[';
    $i=1;
    while($row = mysqli_fetch_assoc($result)) {
        $i++;
        echo json_encode($row, JSON_UNESCAPED_UNICODE);
        if($i<mysqli_num_rows($result)+1){
            echo ",";
        }

    }
    echo "]}";
}else {
  echo '{"code":0,"msg":"","count":0,"data":[ ]}';
}
mysqli_close($link);
?>